package com.zhx.learn.rabbitmq.message;

import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *describe: 
 *
 *@author zhanghaixuan
 *@date 2018/11/16
 **/
@Component
public class FanoutSend {

	@Autowired
	private FanoutExchange fanoutExchange;

	@Autowired
	private RabbitTemplate rabbitTemplate;

	public void send() {
		for(int i = 0; i < 5; i++) {
			rabbitTemplate.convertAndSend(fanoutExchange.getName(), "", "哈哈哈");
		}
	}
}